<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AWTK-JAVA: awtk.RichText类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AWTK-JAVA
   </div>
   <div id="projectbrief">AWTK JAVA API</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>awtk</b></li><li class="navelem"><a class="el" href="classawtk_1_1_rich_text.html">RichText</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-static-methods">静态 Public 成员函数</a> &#124;
<a href="#pub-attribs">Public 属性</a> &#124;
<a href="classawtk_1_1_rich_text-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">awtk.RichText类 参考</div>  </div>
</div><!--header-->
<div class="contents">
<div class="dynheader">
类 awtk.RichText 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classawtk_1_1_rich_text.png" usemap="#awtk.RichText_map" alt=""/>
  <map id="awtk.RichText_map" name="awtk.RichText_map">
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a0cf7d3525a2e01fa7a241e369d1a73fd"><td class="memItemLeft" align="right" valign="top"><a id="a0cf7d3525a2e01fa7a241e369d1a73fd"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>RichText</b> (long nativeObj)</td></tr>
<tr class="separator:a0cf7d3525a2e01fa7a241e369d1a73fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a69370a9ed78c54fd7e670de4ac6480c0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="enumawtk_1_1_ret.html">Ret</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_rich_text.html#a69370a9ed78c54fd7e670de4ac6480c0">setText</a> (String text)</td></tr>
<tr class="separator:a69370a9ed78c54fd7e670de4ac6480c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afbd4770d0622cde0bf4e4786b5cb5c08"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_rich_text.html#afbd4770d0622cde0bf4e4786b5cb5c08">getLineGap</a> ()</td></tr>
<tr class="separator:afbd4770d0622cde0bf4e4786b5cb5c08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3cd62305073a4be49978c57c70fa81c7"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_rich_text.html#a3cd62305073a4be49978c57c70fa81c7">getMargin</a> ()</td></tr>
<tr class="separator:a3cd62305073a4be49978c57c70fa81c7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
静态 Public 成员函数</h2></td></tr>
<tr class="memitem:aa7fe2ec05a8a971f59ee935d46e2b848"><td class="memItemLeft" align="right" valign="top"><a id="aa7fe2ec05a8a971f59ee935d46e2b848"></a>
static <a class="el" href="classawtk_1_1_rich_text.html">RichText</a>&#160;</td><td class="memItemRight" valign="bottom"><b>cast</b> (long nativeObj)</td></tr>
<tr class="separator:aa7fe2ec05a8a971f59ee935d46e2b848"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abf929a7fed6024cd07fa18db1cefd22f"><td class="memItemLeft" align="right" valign="top">static Widget&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_rich_text.html#abf929a7fed6024cd07fa18db1cefd22f">create</a> (Widget parent, int x, int y, int w, int h)</td></tr>
<tr class="separator:abf929a7fed6024cd07fa18db1cefd22f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52c2f9366361e131e1ba5f563c35b13f"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classawtk_1_1_rich_text.html">RichText</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classawtk_1_1_rich_text.html#a52c2f9366361e131e1ba5f563c35b13f">cast</a> (Widget widget)</td></tr>
<tr class="separator:a52c2f9366361e131e1ba5f563c35b13f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public 属性</h2></td></tr>
<tr class="memitem:ac26ed8a0059391e0306f70e56f9c83c3"><td class="memItemLeft" align="right" valign="top"><a id="ac26ed8a0059391e0306f70e56f9c83c3"></a>
long&#160;</td><td class="memItemRight" valign="bottom"><b>nativeObj</b></td></tr>
<tr class="separator:ac26ed8a0059391e0306f70e56f9c83c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>图文混排控件，实现简单的图文混排。</p>
<p>rich_text_t是widget的子类控件，widget_t的函数均适用于rich_text_t控件。</p>
<p>在xml中使用"rich\_text"标签创建图文混排控件。如：</p>
<div class="fragment"><div class="line">&lt;<span class="keywordtype">rich_text</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;0&quot;</span> <span class="keyword">y</span>=<span class="stringliteral">&quot;0&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;100%&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;60&quot;</span></div><div class="line"><span class="keyword">text</span>=&quot;&lt;<span class="keywordtype">image</span> <span class="keyword">name</span>=&amp;<span class="keyword">quota</span>;<span class="keyword">bricks</span>&amp;<span class="keyword">quota</span>;/&gt;&lt;<span class="keywordtype">font</span> <span class="keyword">align_v</span>=&amp;<span class="keyword">quota</span>;<span class="keyword">middle</span>&amp;<span class="keyword">quota</span>;&gt;<span class="keyword">hello</span> <span class="keyword">awtk</span>!&lt;/<span class="keywordtype">font</span>&gt;&quot; /&gt;</div></div><!-- fragment --><p>更多用法请参考： <a href="https://github.com/zlgopen/awtk/blob/master/demos/assets/default/raw/ui/rich_text.xml">rich_text.xml</a></p>
<p>在c代码中使用函数rich_text_create创建图文混排控件。如：</p>
<p>完整示例请参考： <a href="https://github.com/zlgopen/awtk-c-demos/blob/master/demos/rich_text.c">rich_text demo</a></p>
<p>可用通过style来设置控件的显示风格，如背景颜色等等。而字体的大小和颜色则由文本内部的属性决定。</p>
<p>目前支持image和font两个tag：</p>
<ul>
<li>image 支持的属性有：</li>
<li>name 图片的名称。</li>
<li>w 图片的宽度。</li>
<li>h 图片的高度。</li>
<li>font 支持的属性有：</li>
<li>color 颜色。</li>
<li>size 大小。</li>
<li>align_v 垂直方向对齐的方式(top|middle|bottom)。</li>
<li>bold 粗体(暂不支持)</li>
<li>italic 斜体(暂不支持)</li>
<li>underline 下划线(暂不支持) </li>
</ul>
</div><h2 class="groupheader">成员函数说明</h2>
<a id="a52c2f9366361e131e1ba5f563c35b13f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a52c2f9366361e131e1ba5f563c35b13f">&#9670;&nbsp;</a></span>cast()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classawtk_1_1_rich_text.html">RichText</a> awtk.RichText.cast </td>
          <td>(</td>
          <td class="paramtype">Widget&#160;</td>
          <td class="paramname"><em>widget</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>转换为rich_text对象(供脚本语言使用)。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">widget</td><td>rich_text对象。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>rich_text对象。 </dd></dl>

</div>
</div>
<a id="abf929a7fed6024cd07fa18db1cefd22f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abf929a7fed6024cd07fa18db1cefd22f">&#9670;&nbsp;</a></span>create()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static Widget awtk.RichText.create </td>
          <td>(</td>
          <td class="paramtype">Widget&#160;</td>
          <td class="paramname"><em>parent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>w</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>h</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>创建rich_text对象</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">parent</td><td>父控件 </td></tr>
    <tr><td class="paramname">x</td><td>x坐标 </td></tr>
    <tr><td class="paramname">y</td><td>y坐标 </td></tr>
    <tr><td class="paramname">w</td><td>宽度 </td></tr>
    <tr><td class="paramname">h</td><td>高度</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>对象。 </dd></dl>

</div>
</div>
<a id="afbd4770d0622cde0bf4e4786b5cb5c08"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afbd4770d0622cde0bf4e4786b5cb5c08">&#9670;&nbsp;</a></span>getLineGap()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int awtk.RichText.getLineGap </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>行间距。 </p>

</div>
</div>
<a id="a3cd62305073a4be49978c57c70fa81c7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3cd62305073a4be49978c57c70fa81c7">&#9670;&nbsp;</a></span>getMargin()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int awtk.RichText.getMargin </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>边距。 </p>

</div>
</div>
<a id="a69370a9ed78c54fd7e670de4ac6480c0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a69370a9ed78c54fd7e670de4ac6480c0">&#9670;&nbsp;</a></span>setText()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="enumawtk_1_1_ret.html">Ret</a> awtk.RichText.setText </td>
          <td>(</td>
          <td class="paramtype">String&#160;</td>
          <td class="paramname"><em>text</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>设置文本。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">text</td><td>文本。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>output/RichText.java</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
